<template>
  <BasicDrawer
    v-bind="$attrs"
    @register="registerDrawer"
    :showFooter="false"
    :title="getTitle"
    :isDetail="false"
    :width="getIsMobile ? '95%':'80%'"
    @ok="handleSubmit"
  >
    
    <div class="desc-wrap">
      <div v-for="i in 10" :key="i">这是用户{{ state.data }}操作日志Tab</div>
    </div>
  </BasicDrawer>
</template>

<script lang="ts" setup>
  import { reactive } from 'vue';
  import { useAppInject } from '@/hooks/web/useAppInject';
  import { BasicDrawer, useDrawerInner } from '@/components/Drawer';

  defineOptions({ name: 'TradeLogDetailDrawer' });

  const { getIsMobile } = useAppInject();
  const emit = defineEmits(['success', 'register']);
  const state = reactive({
    data: {}
  });
  const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {

    setDrawerProps({ confirmLoading: false });
    // 需要在setFieldsValue之前先填充treeData，否则Tree组件可能会报key not exist警告
    // if (unref(treeData).length === 0) {
    //   treeData.value = (await getMenuList()) as any as TreeItem[];
    // }
    state.data = data;
  });

  const getTitle = '链路日志详情';

  async function handleSubmit() {
    try {
      setDrawerProps({ confirmLoading: true });
      closeDrawer();
      emit('success');
    } finally {
      setDrawerProps({ confirmLoading: false });
    }
  }

</script>

<style></style>
